package com.frinder.hadoop.job.electricity;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * @author frinder
 * @date 2018/6/25
 * @Description: ${todo}
 */
public class ElectricityReducer extends Reducer<Text, IntWritable, Text, IntWritable> {

    private final IntWritable maxAvg = new IntWritable(30);

    @Override
    protected void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException {
        for (IntWritable val : values) {
            if (val.compareTo(maxAvg) > 0) {
                context.write(key, val);
            }
        }
    }

}
